package com.finalProject;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    private static final String TAG ="startpage" ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent start;
        switch (item.getItemId()) {
            case R.id.action_2:
                start=new Intent(MainActivity.this,incomeTop100_Spider_and_Show.class);
                this.startActivity(start);
                Log.i(TAG, "收入排行榜:跳转完毕 ");
                this.finish();
                break;
            case R.id.action_3:
                start=new Intent(MainActivity.this,housepriceTop300_Spider_and_Show.class);
                this.startActivity(start);
                Log.i(TAG, "房价排行榜:跳转完毕 ");
                this.finish();
                break;
            case R.id.action_4:
                start=new Intent(MainActivity.this,house_loan_calculater.class);
                this.startActivity(start);
                Log.i(TAG, "房贷计算器:跳转完毕 ");
                this.finish();
                break;
            case R.id.action_5:
                Log.i(TAG, "onOptionsItemSelected: 退出成功");
                System.exit(0);
                this.finish();
                break;

        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        getMenuInflater().inflate(R.menu.menu, menu);
        return super.onCreateOptionsMenu(menu);
    }

}